package net.lab1024.sa.admin.module.business.ai.service.impl;

import net.lab1024.sa.admin.module.business.ai.model.dto.AiChatRequestDTO;
import net.lab1024.sa.admin.module.business.ai.service.AiModelInvokeService;
import net.lab1024.sa.admin.module.business.ai.manager.AiModelManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;

@Service
public class AiModelInvokeServiceImpl implements AiModelInvokeService {

    @Autowired
    private AiModelManager aiModelManager;

    @Override
    public String chat(AiChatRequestDTO request) {
        return aiModelManager.chat(
            request.getModelName(),
            request.getPrompt(),
            request.getParams(),
            request.getRoleId(),
            request.getPromptIds() // 这里类型为List<String>，即别名
        );
    }

    @Override
    public Flux<String> chatStream(AiChatRequestDTO request) {
        return aiModelManager.chatStream(
            request.getModelName(),
            request.getPrompt(),
            request.getParams(),
            request.getRoleId(),
            request.getPromptIds()
        );
    }
} 